package com.hb.core.pojo.center.sys.entity;

import com.hb.core.pojo.parent.MPCommonEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * 目录资源信息表
 *
 * @author zjk
 * @since 2021-05-24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_menu_resource")
@ApiModel(value = "MenuResource对象", description = "目录资源信息表")
public class MenuResource extends MPCommonEntity {

    @ApiModelProperty(value = "父级ID")
    private Long parentId;

    @ApiModelProperty(value = "资源名称")
    private String resName;

    @ApiModelProperty(value = "跳转路由")
    private String targetPath;

    @ApiModelProperty(value = "页面路径")
    private String pageUrl;

    @ApiModelProperty(value = "图标")
    private String icon;

    @ApiModelProperty(value = "类型(1: 菜单, 2: 按钮)")
    private Integer resType;

    @ApiModelProperty(value = "权限代码")
    private String authCode;

    @ApiModelProperty(value = "数据层级")
    private Integer level;

    @ApiModelProperty(value = "排序号")
    private Integer sortNum;

    @ApiModelProperty(value = "前端要求的字段, 咱也不知道干嘛用的")
    private Integer activeMenu;

    @ApiModelProperty(value = "备注")
    private String note;

    /**
     * 参数验证方法
     * 所有的继承该类的DTO对象必须在调用时重写该方法
     * 该方法中验证的字段对应数据库中不能为空的字段
     *
     * @param fieldNames
     * @return
     */
    @Override
    public String paramsValid(String... fieldNames) {
        return super.paramsValid("resName", "resType", "authCode");
    }
}
